package com.mongoplus.controller;

import com.mongoplus.entity.User;
import com.mongoplus.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("save1")
    public void save1(){
        userService.savaUser();
    }

    @PostMapping("save2")
    public void save2(){
        User user1 = new User();
        user1.setAge(22);
        user1.setUsername("User02");
        user1.setPassword("123456");
        user1.setEmile("123456@qq.com");
        user1.setBirthday(LocalDateTime.of
                (2003,7,23,12,30));
        userService.save(user1);
    }
}
